﻿using System;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;

public partial class _ListagemInscritosCurso : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["codcurso"] != null)
        {
            SqlConnection conexaoIntranet = new SqlConnection(ConfigurationManager.ConnectionStrings["conexao_intranet"].ConnectionString);
            SqlCommand consultaCurso = null;
            SqlDataReader drCurso;
            try
            {
                if (conexaoIntranet != null && conexaoIntranet.State != ConnectionState.Open)
                    conexaoIntranet.Open();
                string instrucao = "Select Curso FROM CamaraCursos where CodCurso = " + Request.QueryString["codcurso"].ToString();
                consultaCurso = new SqlCommand(instrucao, conexaoIntranet);
                drCurso = consultaCurso.ExecuteReader();
                if (drCurso.HasRows)
                {
                    drCurso.Read();
                    lblCurso.Text = drCurso["curso"].ToString().ToUpper();
                }
                drCurso.Close();
            }
            finally
            {
                conexaoIntranet.Close();
            }

        }
    }
}